home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
58606
/
58606.xpi
/
chrome
/
translator.jar
/
content
/
jquery.boolean.js
< prev
next >
Wrap
Text File
|
2010-01-13
|
532b
|
26 lines
(function($)
{
$.fn.boolean = function(name, value, type)
{
// reading attribute
if(value === undefined) {
value = $(this).attr(name, value, type);
return (value == 'true' || value == '1');
}
// writing attribute
if(value === true) {
return $(this).attr(name, 'true', type);
}
else if(value === false) {
return $(this).removeAttr(name);
}
else {
// if value is not boolean call regular attr function
return $(this).attr(name, value, type);
}
};
})(jQuery);